// Capture Druggy event
function mysubmit(event) {
	try
	{
		var resid = event.target.resid;
		var useres = event.target.useres;
		var amount = event.target.amount;
		//alert(resid.value+":"+useres.value+":"+amount.value);
		if ((resid.value == '51') && (useres.value = 'Use'))
		{
			druggySave(amount.value);
		}	
	}
	catch(e)
	{
		// not a druggy form
	}
}

window.addEventListener('submit', mysubmit, true);

// If Partial refresh is enabled
var local_useRes = window.useRes;// overriding this function
if(local_useRes){//if the function doesn't exist it's no use overriding it
	window.useRes = function(resid, value){
		local_useRes(resid,value);//cal original function
		if (resid == '51')
		{
			druggySave(value);
		}		
	}
}
